package abstractEntities;

import java.util.Date;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import entities.Departament;
import entities.User;
import entitiesIds.DepartamentleaderId;

/**
 * AbstractDepartamentleader entity provides the base persistence definition of
 * the Departamentleader entity. @author MyEclipse Persistence Tools
 */
@MappedSuperclass
public abstract class AbstractDepartamentleader implements java.io.Serializable {

	// Fields

	/**
	 * 
	 */
	private static final long serialVersionUID = 4228695705970982647L;
	private DepartamentleaderId id;
	private Departament departament;
	private User user;
	private Date heldDate;

	// Constructors

	/** default constructor */
	public AbstractDepartamentleader() {
	}

	/** full constructor */
	public AbstractDepartamentleader(DepartamentleaderId id,
			Departament departament, User user, Date heldDate) {
		this.id = id;
		this.departament = departament;
		this.user = user;
		this.heldDate = heldDate;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides({
			@AttributeOverride(name = "idUser", column = @Column(name = "idUser", nullable = false)),
			@AttributeOverride(name = "idDepartament", column = @Column(name = "idDepartament", nullable = false)) })
	public DepartamentleaderId getId() {
		return this.id;
	}

	public void setId(DepartamentleaderId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idDepartament", nullable = false, insertable = false, updatable = false)
	public Departament getDepartament() {
		return this.departament;
	}

	public void setDepartament(Departament departament) {
		this.departament = departament;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "idUser", nullable = false, insertable = false, updatable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "heldDate", nullable = false, length = 10)
	public Date getHeldDate() {
		return this.heldDate;
	}

	public void setHeldDate(Date heldDate) {
		this.heldDate = heldDate;
	}

}